import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'constants/app_theme.dart';
import 'providers/mood_provider.dart';
import 'providers/diary_provider.dart';
import 'screens/home_screen.dart';
import 'screens/thought_reshaping_screen.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  final moodProvider = MoodProvider();
  await moodProvider.init();

  runApp(
    MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => moodProvider),
        ChangeNotifierProvider(create: (_) => DiaryProvider()),
      ],
      child: MaterialApp(
        title: '情绪日记',
        theme: AppTheme.lightTheme,
        initialRoute: '/',
        routes: {
          '/': (context) => const HomeScreen(),
          '/thought-reshaping': (context) => const ThoughtReshapingScreen(),
        },
        debugShowCheckedModeBanner: false,
      ),
    ),
  );
}
